package com.lin.entity;

import com.lin.constant.Code;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;
    private String msg;
    private Object data;

    public static R ok(String msg, Object data) {
        return new R(Code.SUCCESS, msg, data);
    }

    public static R failed(String msg, Object data) {
        return new R(Code.FAILED, msg, data);
    }

    public static R error(String msg, Object data) {
        return new R(Code.ERROR, msg, data);
    }
}
